package cn.lll.vuehouse.controller;

import cn.lll.vuehouse.DTO.SaleDTO;
import cn.lll.vuehouse.common.ResponseResult;
import cn.lll.vuehouse.common.ResponseStatus;
import cn.lll.vuehouse.service.SalesbackService;
import lombok.AllArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("saleBack")
public class SaleBackController {

    @Autowired
    private SalesbackService salesbackService;

    @GetMapping("list")
    public ResponseResult getList(SaleDTO saleDTO){
        return salesbackService.getList(saleDTO);
    }

    // 删除
    @DeleteMapping("deleteSaleBackById")
    public ResponseResult deleteSaleById(Integer id){
        ResponseResult responseResult = new ResponseResult();
        salesbackService.removeById(id);
        responseResult.success(ResponseStatus.SUCCESS);
        return responseResult;
    }

}
